using DevExpress.Data;
using DevExpress.LookAndFeel;
using DevExpress.Skins;
using DevExpress.UserSkins;
using DevExpress.Utils;
using DevExpress.XtraEditors;
using Extra.Data;
using Extra.Data.Extra.Class;
using Extra.Data.Extra.UI;
using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Windows.Forms;

namespace Management
{
    public class frmDataManagement : XtraForm
    {
        private IContainer components = null;
        private ImageCollection incMain;
        private XucData ucMain;
        private NotifyIcon notify;
        private DefaultLookAndFeel Skin;
        private string _themePath = Application.StartupPath + "\\Layout\\theme.xml";
        protected override void Dispose(bool disposing)
        {
            if (disposing && this.components != null)
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }
        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(frmDataManagement));
            this.incMain = new ImageCollection(this.components);
            this.notify = new NotifyIcon(this.components);
            this.Skin = new DefaultLookAndFeel(this.components);
            this.ucMain = new XucData();
            this.incMain.BeginInit();
            base.SuspendLayout();
            this.incMain.ImageSize = new Size(32, 32);
            this.incMain.ImageStream = ((ImageCollectionStreamer)componentResourceManager.GetObject("incMain.ImageStream"));
            this.incMain.Images.SetKeyName(0, "Xp-MadB 004.png");
            this.incMain.Images.SetKeyName(1, "ark2.png");
            this.incMain.Images.SetKeyName(2, "ark.png");
            this.incMain.Images.SetKeyName(3, "Dang Ky.png");
            this.incMain.Images.SetKeyName(4, "database_warning.png");
            this.incMain.Images.SetKeyName(5, "databasebackup.png");
            this.incMain.Images.SetKeyName(6, "databaserestore.png");
            this.incMain.Images.SetKeyName(7, "db_status.png");
            this.incMain.Images.SetKeyName(8, "Exit1.png");
            this.incMain.Images.SetKeyName(9, "exit2.png");
            this.incMain.Images.SetKeyName(10, "exit.png");
            this.incMain.Images.SetKeyName(11, "Go Bo.png");
            this.incMain.Images.SetKeyName(12, "kthememgr.png");
            this.incMain.Images.SetKeyName(13, "May chu.png");
            this.incMain.Images.SetKeyName(14, "Nap.png");
            this.incMain.Images.SetKeyName(15, "Phuc Hoi.png");
            this.incMain.Images.SetKeyName(16, "Sao Luu.png");
            this.incMain.Images.SetKeyName(17, "StockPNG.png");
            this.incMain.Images.SetKeyName(18, "Tao.png");
            this.incMain.Images.SetKeyName(19, "Update.png");
            this.incMain.Images.SetKeyName(20, "Web Database.png");
            this.incMain.Images.SetKeyName(21, "Windows Mail.png");
            this.incMain.Images.SetKeyName(22, "WorldOfWacraftSZ.png");
            this.incMain.Images.SetKeyName(23, "xoa.png");
            this.incMain.Images.SetKeyName(24, "info.png");
            this.incMain.Images.SetKeyName(25, "Help and Support.png");
            this.incMain.Images.SetKeyName(26, "Thong Tin.png");
            this.notify.BalloonTipIcon = ToolTipIcon.Info;
            this.notify.BalloonTipText = "        Phần Mềm Quản Lý Cơ Sở Dữ Liệu được phát triển bởi Công Ty Phần Mềm Hoàn Hảo, với mục đích giúp người sử dụng quản lý dữ liệu của mình khi sử dụng các phần mềm của công ty.\r\n";
            this.notify.BalloonTipTitle = "Quản Lý Cơ Sở Dữ Liệu";
            this.notify.Icon = (Icon)componentResourceManager.GetObject("notify.Icon");
            this.notify.Text = "Quản Lý Cơ Sở Dữ Liệu";
            this.notify.BalloonTipClicked += new EventHandler(this.notify_BalloonTipClicked);
            this.notify.DoubleClick += new EventHandler(this.notify_DoubleClick);
            this.notify.MouseDown += new MouseEventHandler(this.notify_MouseDown);
            this.Skin.LookAndFeel.SkinName = "Blue";
            this.ucMain.Dock = DockStyle.Fill;
            this.ucMain.Location = new Point(0, 0);
            this.ucMain.LookAndFeel.SetSkinStyle("Blue");
            this.ucMain.Name = "ucMain";
            this.ucMain.Size = new Size(644, 461);
            this.ucMain.TabIndex = 0;
            this.ucMain.MouseLeave += new EventHandler(this.frmMain_MouseLeave);
            this.ucMain.MouseHover += new EventHandler(this.frmMain_MouseHover);
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(644, 461);
            base.Controls.Add(this.ucMain);
            base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
            base.Name = "frmDataManagement";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "Quản Lý Cơ Sở Dữ Liệu";
            base.Deactivate += new EventHandler(this.frmMain_Deactivate);
            base.Activated += new EventHandler(this.frmMain_Activated);
            base.MouseLeave += new EventHandler(this.frmMain_MouseLeave);
            base.FormClosing += new FormClosingEventHandler(this.frmMain_FormClosing);
            base.Resize += new EventHandler(this.frmMain_Resize);
            base.MouseHover += new EventHandler(this.frmMain_MouseHover);
            this.incMain.EndInit();
            base.ResumeLayout(false);
        }
        public frmDataManagement()
        {
            SkinManager.EnableFormSkins();
            CurrencyDataController.DisableThreadingProblemsDetection = true;
            this.InitializeComponent();
            BonusSkins.Register();
            OfficeSkins.Register();
            SkinManager.EnableFormSkins();
            if (File.Exists(this._themePath))
            {
                this.Skin.LookAndFeel.SetSkinStyle(this.LoadTheme());
            }
            this.ucMain.FormLogin.Logined += new xfmLogin.LoginedEventHander(this.FormLogin_Logined);
            this.ucMain.FormLogin.Reload();
            this.ucMain.FormLogin.ShowDialog();
        }
        private string LoadTheme()
        {
            DataSet dataSet = new DataSet();
            dataSet.ReadXml(this._themePath);
            return dataSet.Tables[0].Rows[0][0].ToString();
        }
        private void FormLogin_Logined(object sender, string connecstring)
        {
            Extra.Data.Extra.Class.DataController.ConnectString = connecstring;
            this.ucMain.DatabaseReload();
        }
        private void frmMain_Resize(object sender, EventArgs e)
        {
        }
        private void notify_DoubleClick(object sender, EventArgs e)
        {
        }
        private void notify_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                this.notify.ShowBalloonTip(5000);
            }
        }
        private void notify_BalloonTipClicked(object sender, EventArgs e)
        {
        }
        private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.notify.Visible = false;
        }
        private void frmMain_Activated(object sender, EventArgs e)
        {
        }
        private void frmMain_Deactivate(object sender, EventArgs e)
        {
        }
        private void frmMain_MouseLeave(object sender, EventArgs e)
        {
        }
        private void frmMain_MouseHover(object sender, EventArgs e)
        {
        }
    }
}